package cn.com.yang.thread;

import java.util.concurrent.CompletableFuture;

import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;

/**
 * 测试多线程，线程池
 * @author yangyijin
 * @since 2023年5月24日-下午2:46:35
 */
public class TestMultiThread {
	public static void main(String[] args) {
		ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
		executor.setThreadPriority(7);// 默认是5
		executor.setCorePoolSize(10); // 核心运行线程数
		executor.setQueueCapacity(50);// 默认是Integer.MAX_VALUE
		CompletableFuture.runAsync(()->{
			//执行任务
		},executor);
//		CompletableFuture.supplyAsync(()->{
//			//执行任务
//			return 0;
//		},executor);
	}
}
